var login = document.getElementById('login');
var bg = document.getElementById('bg');

// 点击"点击，弹出登陆框"，弹出登陆窗口和遮盖层
var adminBtn = document.getElementById('adminBtn');

adminBtn.onclick = function() {
  login.style.display = "block";
  bg.style.display = "block";
  return false;
}

// 点击"关闭"，隐藏登陆窗口和遮盖层
var closeBtn = document.getElementById('closeBtn');

closeBtn.onclick = function() {
  alert('进来了还想走不可能(｀▽′)Ψ !!!');
  login.style.display = "none";
  bg.style.display = "none";
  return false;
}

// 鼠标拖拽功能
var login_title = document.getElementById('login-title');
var isDragging = false;
var offsetX, offsetY;

login_title.onmousedown = function(e) {
  e = e || window.event;
  offsetX = e.clientX - login.offsetLeft;
  offsetY = e.clientY - login.offsetTop;
  isDragging = true;
}

document.onmousemove = function(e) {
  if (isDragging) {
    e = e || window.event;
    login.style.left = e.clientX - offsetX + 'px';
    login.style.top = e.clientY - offsetY + 'px';
  }
}

document.onmouseup = function() {
  isDragging = false;
}

